const express = require('express');
// const session = require('express-session')
const mongoStore = require('connect-mongo')
const path = require('path')
const pageRouter = require('./router/router')
const apirouter = require('./router/api')
const app = express();


app.use(express.static(path.join(__dirname,'../public')));


// app.use(session({
//     name:'sid',
//     secret:'Dingyuxiang',
//     saveUninitialized:false,
//     store:mongoStore.create({
//         mongoUrl:'mongodb://127.0.0.1:27017/event'
//     }),
//     cookie:{
//         httpOnly:true,
//         maxAge:1000*60*60*24*7
//     }
// }))

app.use(express.urlencoded({ extended: true })); 
app.use(express.json()); 

app.use('/',pageRouter)
app.use('/api',apirouter)




app.listen('9000',()=>{
    console.log('ok');
})